﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Infrastructure;
using Microsoft.Practices.Unity;
using Microsoft.Practices.Prism.Events;
using Microsoft.Practices.Prism.Commands;
using System.Windows;
using Infrastructure.Events;
using Microsoft.Practices.Prism.Regions;
using Telerik.Windows.Controls;

namespace ALPShell.ViewModel
{
    public class ShellViewModel : Infrastructure.ViewModelBase
    {
        public ShellViewModel(IUnityContainer container, IEventAggregator eventAggregator, IRegionManager regionMgr)
            : base(container, eventAggregator)
        {
            this.SwitchUser = new DelegateCommand<object>(OnSwitchUser);
        }

        public DelegateCommand<object> SwitchUser { get; set; }

        public void OnSwitchUser(object sender)
        {
            LogonWindow logon = Container.Resolve<LogonWindow>();
            LogonWindowViewModel vm = Container.Resolve<LogonWindowViewModel>();
            vm.IsSwitchUser = true;
            logon.DataContext = vm;

            logon.ShowDialog();
        }
    }
}
